package com.sys.server.modules.controller;

import com.sys.server.common.annotation.Authentication;
import com.sys.server.common.constants.enums.ResultSetEnum;
import com.sys.server.common.model.R;
import com.sys.server.modules.controller.dto.OperLogDto;
import com.sys.server.modules.service.OperLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Authentication
@Api(tags = "操作日志模块")
public class OperLogController {

    @Autowired
    private OperLogService logService;

    @PostMapping(value = "/getOperLogs")
    @ApiOperation(value = "操作日志模块--分页查询操作日志")
    public R queryLogs(@ApiParam(value = "查询参数") @RequestBody OperLogDto logDto) {
        if (logDto.getPageNum() == null || logDto.getPageSize() == null) {
            return R.ok(ResultSetEnum.PARAMS_ERROR);
        }
        return logService.getOperLog(logDto);
    }

}
